package com.skyolder.crutch.word.raw;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

public class CharReader {
	private BufferedReader bufferedReader=null;
	public CharReader(File file) throws FileNotFoundException {
		bufferedReader=new BufferedReader(new FileReader(file));
	}
	public CharReader(InputStream inputstream) throws UnsupportedEncodingException{
		bufferedReader=new BufferedReader(new InputStreamReader(inputstream,"UTF8"));
	}
	public CharReader(Reader reader) throws FileNotFoundException {
		bufferedReader=new BufferedReader(reader);
	}
	public CharReader(String src){
		bufferedReader=new BufferedReader( new StringReader(src));
	}
	public Character nextChar() throws IOException{
		int i=bufferedReader.read();
		if(i<0){
			return null;
		}
		return (char)i;
	}
}
